﻿using DataLayer.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataLayer.Repositories
{
    public class FitbitAccountRepository : Repository<FitbitAccount>
    {
        public FitbitAccountRepository(GameUPContext context) : base(context) { }

        public IEnumerable<FitbitAccount> GetAccountShouldBeDelete()
        {
            return _Collection.Where(f => f.ShouldRemove);
        }

        public IEnumerable<FitbitAccount> GetUnsubscribersAccounts()
        {
            return _Collection.Where(f => !f.IsSubscribed || string.IsNullOrWhiteSpace(f.AccessSecret) || string.IsNullOrWhiteSpace(f.AccessToken) || string.IsNullOrWhiteSpace(f.OwnerID));
        }

        public FitbitAccount GetByOwnerId(string OwnerId)
        {
            return _Collection.FirstOrDefault(f => f.OwnerID == OwnerId);
        }

    }
}
